const { BrowserWindow } = require("electron");

class AppWindow extends BrowserWindow {
  constructor(config, urlLocation) {
    const defaultConfig = {
      webPreferences: {
        nodeIntegration: true,
        contextIsolation: false,
      },
      show: false,
      backgroundColor: "#efefef",
    };
    const baseConfig = { ...defaultConfig, ...config };
    super(baseConfig);
    this.loadURL(urlLocation);
    this.once("ready-to-show", () => {
      this.show();
    });
  }
}

module.exports = AppWindow;
